package uk.co.cocking.getinline2.record;

public class StringField implements Field {

	@Override
	public String toString() {
		return fieldName + "=" + value;
	}

	private final String fieldName;
	private final String value;

	public StringField(String fieldName, String value) {
		this.fieldName = fieldName;
		this.value = value;
	}

	public String fieldName() {
		return fieldName;
	}

	public String value() {
		return value;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof StringField)) {
			return false;
		}
		StringField other = (StringField) obj;
		return fieldName.equals(other.fieldName) && value.equals(other.value);
	}

	@Override
	public int hashCode() {
		return fieldName.hashCode() + value.hashCode();
	}

}
